#include "menu_run.h"
#include "../lcd_global.h"
#include "../lcd.h"
#include "module/GPS/GPS.h"
#include "module/camera/camera.h"
#include "module/ledboard/ledboard.h"
#include "control/GPSpath/GPSpath.h"
#include "module/steer/steer.h"
#include "module/pid/pid.h"
#include "module/brake/brake.h"
static void menu_run_init(void *parg);
extern float my_value;
extern float my_distance;
struct Item run_i[MAX_ITEM_NUM] = 
{
    {.ctx = "distance(mm)",     .id = 1,  .ctx_len = 18,  .flag = FILE, .realtime = 1, .value_type = FLOAT, .p_value = (void *)&(my_distance),    .func_enter = nop, nop,  nop,    nop},//encoder[1].distance
    {.ctx = "total_time(s)",     .id = 2,  .ctx_len = 18,  .flag = FILE,    .realtime = 1, .value_type = FLOAT, .p_value = (&my_value),            .func_enter =   nop, nop,  nop,    nop},//(void *)&gpspath.timecd
    {.ctx = "rotation",     .id = 3,  .ctx_len = 18,  .flag = FILE,    .realtime = 1, .value_type = FLOAT, .p_value = (void *)&ledboard.offset,            .func_enter =   nop, nop,  nop,    nop},

};

struct Node run_n = 
{
    // .itemnum        = sizeof(run_i) / sizeof(run_i[0]),
    // .page_num       = (unsigned short)sizeof(run_i) / sizeof(run_i[0])/PAGE_SIZE,
    .page_index     = 0,      //page_index
    .node_id        = 5,      //node_id
    .p_item         = run_i,
    .position       = {0, 0},
    .parent         = &root_n,
    .child          = {0},
    .init           = menu_run_init,
};

static void menu_run_init(void *parg)
{
    unsigned char i = 0;
    for(i = 0;i < MAX_ITEM_NUM;i ++)
    {
        if(run_i[i].ctx[0] == 0){break;}
        run_n.itemnum ++;
    }
    run_n.page_num = run_n.itemnum / PAGE_SIZE;
}
